package com.lingjtx.common.other.http;

import com.lingjtx.common.other.annotation.*;
import com.lingjtx.common.other.model.IPResponse;
import com.lingjtx.common.other.model.jiguang.LoginTokenRequest;
import com.lingjtx.common.other.model.jiguang.LoginTokenResponse;
import com.lingjtx.common.other.model.jiguang.jpush.JPushRequest;
import com.lingjtx.common.other.model.jiguang.jpush.JPushResponse;
import com.lingjtx.common.other.model.sms.SmsCodeResponse;
import com.lingjtx.common.other.model.sms.SmsRequest;
import com.lingjtx.common.other.model.weixin.*;

public interface RemoteService {

    @GET("http://dysmsapi.aliyuncs.com/")
    Call<SmsCodeResponse> sendSms(@QueryObject SmsRequest model);

    @GET("https://ip.cn/api/index")
    Call<IPResponse> getIpAddress(@Query("ip") String ip, @Query("type") Integer type);

    /**
     * 极光一键登录请求响应
     * Headers Authorization的值是根据CommonUtil.getBasicAuth() 计算而来
     *
     * @param loginTokenRequest 请求参数
     * @return LoginTokenResponse
     */
    @Headers("Authorization: Basic ZDcwMGY4MTU1ZmYyZGFmZTJlZTA0ZjY2OjhkZWQ3ZTE1YzIwYTdlZTk3MTU5MzFjZA==")
    @POST("https://api.verification.jpush.cn/v1/web/loginTokenVerify")
    Call<LoginTokenResponse> loginTokenVerify(@Body LoginTokenRequest loginTokenRequest);

    /**
     * 极光推送
     */
    @Headers("Authorization: Basic ZDcwMGY4MTU1ZmYyZGFmZTJlZTA0ZjY2OjhkZWQ3ZTE1YzIwYTdlZTk3MTU5MzFjZA==")
    @POST("https://api.jpush.cn/v3/push")
    Call<JPushResponse> pushNotification(@Body JPushRequest params);

    @GET("https://api.weixin.qq.com/cgi-bin/token")
    Call<AccessTokenResponse> getAccessToken(@QueryObject AccessTokenRequest params);

    @GET("https://api.weixin.qq.com/cgi-bin/ticket/getticket")
    Call<TicketResponse> getTicket(@Query("access_token") String access_token, @Query("type") String type);


    @GET("https://api.weixin.qq.com/sns/oauth2/access_token")
    Call<OauthResponse> getOauthAccessToken(@QueryObject OauthRequest params);


    @GET("https://api.weixin.qq.com/sns/userinfo")
    Call<UserInfoResponse> getUserInfo(@QueryObject UserInfoRequest params);

    // 微信公众号发送模板消息
    @POST("https://api.weixin.qq.com/cgi-bin/message/template/send")
    Call<WeiXinTemplateMsgResponse> sendWxTemplateMsg(@Query("access_token") String access_token, @Body WeiXinTemplateMsgRequest request);
}
